package com.salesmonitoring.accounts.controller;

import java.util.ArrayList;

import com.salesmonitoring.accounts.dao.AccountOfficerDaoImpl;
import com.salesmonitoring.accounts.dao.AdminDaoImpl;
import com.salesmonitoring.accounts.model.Customer;
import com.salesmonitoring.accounts.model.User;
import com.salesmonitoring.model.RepairShop;

public class AdminController {

	private static AdminController adminController;
	
	public static synchronized AdminController getInstance() {
		if(adminController == null)
			adminController = new AdminController();
		
		return adminController;
	}
	
	public int addUser(ArrayList<Object> details) {
		
		AdminDaoImpl adminDaoImpl = AdminDaoImpl.getInstance();
		
		return adminDaoImpl.addUser(details);
		
	}
	
	public int updateUser(User user) {
		
		AdminDaoImpl adminDaoImpl = AdminDaoImpl.getInstance();
		
		return adminDaoImpl.updateUser(user);
	}
	
	public int deleteUser(String username) {
		
		AdminDaoImpl adminDaoImpl = AdminDaoImpl.getInstance();
		
		return adminDaoImpl.deleteUser(username);
		
	}
	
	public String[] getAllAONames() {
		
		AccountOfficerDaoImpl accountOfficerDaoImpl = AccountOfficerDaoImpl.getInstance();
		
		return accountOfficerDaoImpl.getAllAONames();
		
	}
	
	public String[] getAllRoles() {
		
		AdminDaoImpl adminDaoImpl = AdminDaoImpl.getInstance();
		
		return adminDaoImpl.getAllRoles();
		
	}
	
	public String[] getAllWarehouses() {
		
		AdminDaoImpl adminDaoImpl = AdminDaoImpl.getInstance();
		
		return adminDaoImpl.getAllWarehouses();
		
	}
	
	public String[] getAllAccountNumbers() {
		
		AdminDaoImpl adminDaoImpl = AdminDaoImpl.getInstance();
		
		return adminDaoImpl.getAllAccountNumbers();
		
	}
	
	public ArrayList<User> getAllUsers() {
		
		AdminDaoImpl adminDaoImpl = AdminDaoImpl.getInstance();
		
		return adminDaoImpl.getAllUsers();
		
	}
	
	public String[] getAllRepairShops() {
		
		AdminDaoImpl adminDaoImpl = AdminDaoImpl.getInstance();
		
		return adminDaoImpl.getAllRepairShops();
		
	}
	
	public RepairShop getShopBycode(String code) {
		
		AdminDaoImpl adminDaoImpl = AdminDaoImpl.getInstance();
		
		return  adminDaoImpl.getShopByCode(code);
		
	}
	
	public String getCustomerByAccountNumber(String number) {
		
		AdminDaoImpl adminDaoImpl = AdminDaoImpl.getInstance();
		
		return adminDaoImpl.getCutomerbyAccountNumber(number);
		
	}
	
}
